from django.test import TestCase
from django.core.urlresolvers import reverse

class ViewTests(TestCase):
    fixtures = "test_specs", "test_useragents", "test_tests", "test_results"
    def testSpecList(self):
        response = self.client.get(reverse('spec-list', kwargs=dict(page="1")))
        self.assertContains(response, "List of specs")

    def testSpecDetail0(self):
        response = self.client.get(reverse('spec-detail', kwargs=dict(object_id="spec0")))
        self.assertContains(response, "Sample spec 0")

    def testSpecDetail1(self):
        response = self.client.get(reverse('spec-detail', kwargs=dict(object_id="samplespec")))
        self.assertContains(response, "Another sample spec")

        # Contains links to the related tests
        self.assertContains(response, "unit/crashers/crash_firefox_trunk_20081110.svg")
        # And also results
        self.assertContains(response, "FAIL-SINGLE-WINDOW")
